﻿using System.Collections.Generic;
using ESRI.ArcGIS.Carto;
using Inovout.Gis;

namespace Inovout.ArcGis
{
    public class GroupLayerInfo : LayerInfo, IGroupLayerInfo
    {
        #region Constructor
        internal GroupLayerInfo(IGroupLayer arcGroupLayer)
            : base(arcGroupLayer)
        {
    
        }
        #endregion


        #region Layers
        private List<Gis.ILayerInfo> layers;
        public List<Gis.ILayerInfo> Layers
        {
            get
            {
                if (layers == null)
                {
                    layers = new List<Gis.ILayerInfo>();
                    ICompositeLayer compositeLayer = arcLayer as ICompositeLayer;
                    for (int i = 0; i < compositeLayer.Count; i++)
                    {
                        layers.Add(ArcGisHelper.CreateLayer(this,compositeLayer.get_Layer(i)));
                    }
                }
                return layers;
            }
        }
        #endregion
    }
}
